﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArmoryAPI
{
    /// <summary>
    /// An extension of the Achievement class that includes the DateTime that an achievement was unlocked by a character
    /// </summary>
    public class UnlockedAchievement : Achievement
    {
        #region Members

            private DateTime _unlocked;

        #endregion

        #region Properties

            /// <summary>
            /// The DateTime that the achievement was unlocked
            /// </summary>
            public DateTime Unlocked
            {
                get
                {
                    return _unlocked;
                }
            }

        #endregion

        #region Constructors

            internal UnlockedAchievement(int id, String title, int points, String description, long unlockedTimestamp) : base(id, title, points, description)
            {
                _unlocked = new DateTime(1970, 01, 01, 0, 0, 0, 0).AddMilliseconds(unlockedTimestamp);
            }

            internal UnlockedAchievement(Achievement achievement, long unlockedTimestamp)
                : base(achievement.ID, achievement.Title, achievement.Points, achievement.Description)
            {
                _unlocked = new DateTime(1970, 01, 01, 0, 0, 0, 0).AddMilliseconds(unlockedTimestamp);
            }

            internal UnlockedAchievement(int id, String title, int points, String description, DateTime unlocked)
                : base(id, title, points, description)
            {
                _unlocked = unlocked;
            }

            /// <summary>
            /// Constructs an empty UnlockedAchievement
            /// </summary>
            public UnlockedAchievement() : base()
            {
                _unlocked = DateTime.Now;
            }

        #endregion
    }
}
